<?php /* Smarty version 2.6.18, created on 2012-05-16 22:29:02
         compiled from ajax/account-basic-addr.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'html_options', 'ajax/account-basic-addr.tpl', 10, false),)), $this); ?>
<form method="post" id="frmAddr" name="frmAddr" action="<?php echo @HOST_VFRIEND; ?>
account/basicsave" enctype="multipart/form-data">
	<input type="hidden" name="phascode" id="phascode" value="" />
    <input type="hidden" name="ptsave" id="ptsave" value="<?php echo $this->_tpl_vars['intType']; ?>
" />
	<div class="editForm">    	
        <div class="userInput">
        	<label>Quốc gia:</label>
        	<div class="pCountry">
            	<select class="select" id="pcountry" name="pcountry" onchange="javascript:province(this.value,'pprovince','secProvince','secDistrict')" <?php if ($this->_tpl_vars['objUser']->country == ''): ?>title="Chọn"<?php endif; ?>>
                	<option value="">Chọn</option>
                	<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['arrCountry'],'selected' => $this->_tpl_vars['objUser']->country), $this);?>

                </select>
            </div>	
        </div>
        <div class="userInput" id="secProvince">
        	<label>Tỉnh/thành:</label>
        	<div class="pProvince">
            	<select class="select" id="pprovince" name="pprovince" onchange="javascript:district(this.value,'pdistrict','secDistrict')" <?php if ($this->_tpl_vars['objUser']->province == 0): ?>title="Chọn"<?php endif; ?>>
                	<option value="">Chọn</option>
                	<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['arrProvince'],'selected' => $this->_tpl_vars['objUser']->province), $this);?>

                </select>
            </div>	
        </div>
        <div class="userInput" id="secDistrict" <?php if (! $this->_tpl_vars['arrDistrict']): ?>style="display:none"<?php endif; ?>>
        	<label>Quận/huyện:</label>
        	<div class="pDistrict">
            	<select class="select" id="pdistrict" name="pdistrict" <?php if ($this->_tpl_vars['objUser']->district <= 0): ?>title="Chọn"<?php endif; ?>>
                	<option value="">Chọn</option>
                    <?php if ($this->_tpl_vars['objUser']->district > 0): ?>
                		<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['arrDistrict']), $this);?>

                    <?php else: ?>
                    	<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['arrDistrict'],'selected' => $this->_tpl_vars['objUser']->district), $this);?>

                    <?php endif; ?>
                </select>
            </div>		
        </div>
        <div class="userInput">
        	<label for="paddr">Địa chỉ:</label>
        	<input type="text" value="" id="paddr" name="paddr" maxlength="50" class="text clearIt" />	
        </div>       
        <div class="userInput">
        	<input type="submit" value="Thay đổi" class="btn" />
            <input type="button" value="Hủy" class="btn" onclick="javascript:basicClose('<?php echo $this->_tpl_vars['strView']; ?>
','<?php echo $this->_tpl_vars['strEdit']; ?>
')" />
        </div>
    </div>
</form>
<script type="text/javascript" language="javascript" src="<?php echo @HOST_STATICS; ?>
js/library/init.js"></script>
<?php echo '
<script type="text/javascript" language="javascript">
	$(document).ready(function(){
		$("#frmAddr").validate({				
			errorClass		: \'errorMessage\',
			errorElement	: \'span\',
			onfocusout		: false,
			onkeyup			: false,
			rules: {	
				pcountry:{
					required	: true
				},
				pprovince:{
					required	: true
				},
				pdistrict:{
					required	: true
				},
				paddr:{
					required	: true
				}
				
			},
			messages: {	
				pcountry:{
					required	: country_required
				},
				pprovince:{
					required	: province_required
				},
				pdistrict:{
					required	: district_required
				},
				paddr: {
					required	: addr_required
				}
			},		
			errorPlacement: function(label, element) {			
				var id = element.attr(\'id\');			
				label.insertAfter($(\'#\' + id));			
			},
			submitHandler: function(form) {				
				form.submit();
			}
		});	
		province = function(strCountry, divProvince, secProvince, secDistrict) {
			$.getJSON(
				HOST_VFRIEND + \'ajax/province?country=\' + strCountry + \'&callback=?\',		
				function(response) {				
					if(response[\'data\'] != \'\') {	
						$(\'#\'+secProvince).show();				
						$(\'#\'+divProvince).html(response[\'data\']);
						
					}
					else {
						$(\'#\'+secDistrict).hide();
						$(\'#\'+secProvince).hide();
					}
				}
			);							   
		};	
		district = function(intProvince, divDistrict, secDistrict) {
			$.getJSON(
				HOST_VFRIEND + \'ajax/district?province=\' + intProvince + \'&callback=?\',		
				function(response) {				
					if(response[\'data\'] != \'\') {	
						$(\'#\'+secDistrict).show();				
						$(\'#\'+divDistrict).html(response[\'data\']);
						
					}
					else {
						$(\'#\'+secDistrict).hide();
					}
				}
			);							   
		};		
	});
</script>
'; ?>